package com.xuxin.baby.presenter;

import com.xuxin.baby.bean.BaseBean;
import com.xuxin.baby.contract.InoculateContract;
import com.xuxin.baby.model.InoculateModel;

/**
 * Created by xu_xin
 * Created on 2020/10/23 0023
 * 疫苗详情
 */
public class InoculatePresenter implements InoculateContract.Presenter {
    private final InoculateModel model;
    private final InoculateContract.View view;

    public InoculatePresenter(InoculateContract.View view) {
        this.view = view;
        model = new InoculateModel();
    }

    @Override
    public void inoculate(String tenantId, String token, String childId, String vaccineId, String hospital, String actDate) {
        if (null != model) {
            model.inoculate(this, tenantId, token, childId, vaccineId, hospital, actDate);
        }
    }

    @Override
    public void onSuccess(BaseBean baseBean) {
        if (null != view) {
            view.onSuccess(baseBean);
        }
    }

    /**
     * 以下内容复用(用于请求完成后的操作)
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}